package com.sxj.corejava.code07_面向对象.多态;

/**
 * @author 石小俊
 * @date 2025年01月07日
 */
public class Pig extends Pet {
    private String hobby;

    public void show() {
        System.out.println("这是一只宠物猪,姓名:" + getName() + ",性别:" + getGender() + ",爱好:" + hobby);
    }

    public Pig(String name, String gender, String hobby) {
        super(name, gender);
        this.hobby = hobby;
    }

    public String getHobby() {
        return hobby;
    }

    public void setHobby(String hobby) {
        this.hobby = hobby;
    }
}
